﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GonguklubburinnMVC.Models;

namespace GonguklubburinnMVC.Controllers
{
	public class MapController : Controller
	{
		//
		// GET: /Map/

		public ActionResult Index()
		{
			return View();
		}

		public ActionResult GetMarkers()
		{
			// This would normally be our call to the Db, else we could populate this
			// with some data as Ive done here.
			MarkerList markers = GetMarkersObjects();

			return Json(markers, JsonRequestBehavior.AllowGet);

		}
		/// <summary>
		/// Gets the markers. This data could be filled with whatever you 
		/// set from your DB.
		/// </summary>
		/// <returns></returns>
		public static MarkerList GetMarkersObjects()
		{
			//Marker marker = new Marker
			//{
			//    html = "Some stuff to display in the<br>First Info Window",
			//    lat = "51.4109278",
			//    lng = "-0.2091921",
			//    label = "Marker One"
			//};

			Marker marker2 = new Marker
			{
				html = "úlfarsfell",
				lat = "64.146837",
				lng = "-21.711431",
				label = "Marker Two"
			};

			//Marker marker3 = new Marker
			//{
			//    html = "Some stuff to display in the<br>Third Info Window",
			//    lat = "53.08",
			//    lng = "-1.35",
			//    label = "Marker Three"
			//};


			return new MarkerList { markers = new List<Marker> { marker2 } };
		}

	}
}
